package com.cdeledu.thread3.c7hookexception.uncaughtException;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

// 通过submit提交任务到线程池
public class SubmitDemo {

	public static void main(String[] args) throws Exception {
		ExecutorService es = new ThreadPoolExecutor(5, 5, 0l, TimeUnit.MILLISECONDS, new LinkedBlockingDeque<Runnable>(10));
		Future<String> f = es.submit(() -> {
			System.out.println(1 / 0); // 这行会导致报错！
			return "abc";
		});
		// 调用get方法时报异常
		System.out.println(f.get());
    }

}
